{% set host_index = groups['sahara'].index(inventory_hostname) % groups['rabbitmq'] | count %}
{% set rabbit_hosts = groups['rabbitmq'][host_index:] + groups['rabbitmq'][:host_index] %}
[DEFAULT]

# Hostname or IP address that will be used to listen on.
# (string value)
#host=
host = 127.0.0.1

# Port that will be used to listen on. (integer value)
#port=8386

api_paste_config = /usr/share/sahara/api-paste.ini

# If set to True, Sahara will use floating IPs to communicate
# with instances. To make sure that all instances have
# floating IPs assigned in Nova Network set
# "auto_assign_floating_ip=True" in nova.conf.If Neutron is
# used for networking, make sure that all Node Groups have
# "floating_ip_pool" parameter defined. (boolean value)
#use_floating_ips=true

# Use Neutron or Nova Network (boolean value)
#use_neutron=false
use_neutron=True

# Use network namespaces for communication (only valid to use in conjunction
# with use_neutron=True)
#use_namespaces=false
use_namespaces=True

# Maximum length of job binary data in kilobytes that may be
# stored or retrieved in a single operation (integer value)
#job_binary_max_KB=5120

# Postfix for storing jobs in hdfs. Will be added to
# /user/hadoop/ (string value)
#job_workflow_postfix=

# enable periodic tasks (boolean value)
#periodic_enable=true



# Enables data locality for hadoop cluster.
# Also enables data locality for Swift used by hadoop.
# If enabled, 'compute_topology' and 'swift_topology'
# configuration parameters should point to OpenStack and Swift
# topology correspondingly. (boolean value)
#enable_data_locality=false

# File with nova compute topology. It should
# contain mapping between nova computes and racks.
# File format:
# compute1 /rack1
# compute2 /rack2
# compute3 /rack2
# (string value)
#compute_topology_file=etc/sahara/compute.topology

# File with Swift topology. It should contains mapping
# between Swift nodes and racks. File format:
# node1 /rack1
# node2 /rack2
# node3 /rack2
# (string value)
#swift_topology_file=etc/sahara/swift.topology



# Log request/response exchange details: environ, headers and
# bodies. (boolean value)
#log_exchange=false

# Print debugging output (set logging level to DEBUG instead
# of default WARNING level). (boolean value)
#debug=false
debug = {{ sahara_debug }}

# Print more verbose output (set logging level to INFO instead
# of default WARNING level). (boolean value)
#verbose=false

# Log output to standard error. (boolean value)
#use_stderr=true
use_stderr=false

# (Optional) Name of log file to output to. If no default is
# set, logging will go to stdout. (string value)
#log_file=<None>

# (Optional) The base directory used for relative --log-file
# paths. (string value)
#log_dir=<None>

# Use syslog for logging. Existing syslog format is DEPRECATED
# during I, and will change in J to honor RFC5424. (boolean
# value)
#use_syslog=false
use_syslog = {{ sahara_syslog_use }}

# Syslog facility to receive log lines. (string value)
#syslog_log_facility=LOG_USER

# List of plugins to be loaded. Sahara preserves the order of
# the list when returning it. (list value)
#plugins=vanilla,hdp,spark,cdh

transport_url = rabbit://{% for host in rabbit_hosts %}{{ sahara_rabbit_user }}:{{ sahara_rabbit_password }}@{{ hostvars[host].ip.mgmt }}:5672{% if not loop.last %},{% endif %}{% endfor %}/{{ sahara_rabbit_vhost }}

os_region_name = {{ keystone_region_name }}

{% if groups['zookeeper'] | count > 0 %}
periodic_coordinator_backend_url = kazoo://{% for host in groups['zookeeper'] %}{{ hostvars[host].ip.mgmt }}:2181{% if not loop.last %},{% endif %}{% endfor %}
{% endif %}


[oslo_messaging_notifications]

enable = true
driver = messagingv2
transport_url = rabbit://{% for host in rabbit_hosts %}{{ sahara_rabbit_user }}:{{ sahara_rabbit_password }}@{{ hostvars[host].ip.mgmt }}:5672{% if not loop.last %},{% endif %}{% endfor %}/{{ sahara_rabbit_vhost }}


[oslo_messaging_rabbit]

rabbit_ha_queues = true


[database]

# The SQLAlchemy connection string used to connect to the
# database (string value)
#connection=<None>
connection = mysql+pymysql://{{ sahara_db_user }}:{{ sahara_db_password }}@{{ sahara_mysql_server }}/{{ sahara_db }}?charset=utf8
max_retries = -1


[keystone_authtoken]
{% if SSLCACertificateFile != '' %}
cafile = {{ SSLCACertificateFile }}
{% endif %}
insecure = {{ ssl_insecure }}
auth_type = password
signing_dir = /var/lib/sahara/cache/api
auth_uri = {{ keystone_proto }}://{{ keystone_internal_address }}:5000
auth_url = {{ keystone_proto }}://{{ keystone_internal_address }}:35357
region_name = {{ keystone_region_name }}
user_domain_name = {{ sahara_domain_name }}
username = {{ sahara_admin_user }}
password = {{ sahara_admin_password }}
project_domain_name = {{ sahara_project_domain_name }}
project_name = {{ sahara_project_name }}
memcache_security_strategy = ENCRYPT
memcache_secret_key = {{ memcache_secret_key }}
memcached_servers = {% for host in groups['memcached'] %}{{ hostvars[host].ip.mgmt }}:11211{% if not loop.last %},{% endif %}{% endfor %}

[keystone]
{% if SSLCACertificateFile != '' %}
ca_file = {{ SSLCACertificateFile }}
{% endif %}
api_insecure = {{ ssl_insecure }}

[cinder]
{% if SSLCACertificateFile != '' %}
ca_file = {{ SSLCACertificateFile }}
{% endif %}
api_insecure = {{ ssl_insecure }}

[neutron]
{% if SSLCACertificateFile != '' %}
ca_file = {{ SSLCACertificateFile }}
{% endif %}
api_insecure = {{ ssl_insecure }}

[nova]
{% if SSLCACertificateFile != '' %}
ca_file = {{ SSLCACertificateFile }}
{% endif %}
api_insecure = {{ ssl_insecure }}

[swift]
{% if SSLCACertificateFile != '' %}
ca_file = {{ SSLCACertificateFile }}
{% endif %}
api_insecure = {{ ssl_insecure }}

[manila]
{% if SSLCACertificateFile != '' %}
ca_file = {{ SSLCACertificateFile }}
{% endif %}
api_insecure = {{ ssl_insecure }}
